{include file="public/header" /}
<body class="hide-top bgc">
<div class="submit-container">
    <img src="/static/index/img/icon55.png" alt="">
    <div class="submit-content">
        <div class="submit-hd flex-center">
            <i class="layui-icon layui-icon-left"></i>确认订单
        </div>
        <div class="submit-site flex-layout">
            {if $temporary.address}
            <div class="choice_address">
                <div>
                    <img src="/static/index/img/icon56.png" alt="">{$temporary.address.nickname}
                    {$temporary.address.tel}
                </div>
                <p>
                    {$temporary.address.p.title}{$temporary.address.c.title}{$temporary.address.d.title}{$temporary.address.details}</p>
            </div>
            {else}
            <div  class="add_address" style="display: flex;justify-content: space-between;align-items: center;width: 100%">
                <div>请添加收货地址</div>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            {/if}
        </div>

        <div class="submit-pro">
            <ul class="submit-pro-list">
                {foreach name="temporary.product" item="product"}
                <li>
                    <p class="flex-center">
                        <img src="{$product.icon}" alt="">
                    </p>
                    <div class="center">
                        <p class="multi">{$product.title}</p>
                        <p class="spec">{$product.sku_name}</p>
                    </div>
                    <div class="rgt">
                        <p class="price">￥<span>{$product.vip_price}</span></p>
                        <p>x{$product.num}</p>
                    </div>
                </li>
                {/foreach}
            </ul>
            <ul class="submit-pro-form">

                <li>买家留言：
                    <input type="text" id="remark" placeholder="选填">
                </li>
            </ul>
        </div>

        <div class="submit-pro">
            <ul class="submit-pro-form">
                <li>商品总额
                    <p>￥{$temporary.realTotal}</p>
                </li>

            </ul>
        </div>
    </div>
</div>

<div class="submit-footer">
    <div>
        <p>应付总额：<span>￥{$temporary.realTotal}</span></p>

    </div>
    <p class="flex-center submitOrder">提交订单</p>
</div>
</body>
{include file="public/footer"/}
<script>
    $('.submitOrder').click(function () {
        var address_id = '{$temporary.address?$temporary.address.id:""}';
        if (!address_id) {
            layer.msg('请选择收货地址');
            return false;
        }
        return common.request("{:url('order/submit')}", {address_id: address_id, remark: $("#remark").val()})
    });
    $('.add_address').click(function () {
        location.href = "{:url('address/add')}?type=add";
    });
    $('.choice_address').click(function () {
        layer.open({
            type: 2,
            offset: 'b',
            anim: 'slideUp', // 从下往上
            title: '请选择收货地址',
            shadeClose: true,
            shade: 0.8,
            area: ['100%', '60%'],
            content: '{:url(\'address/index\')}?type=choice' //iframe的url
        });
    });
</script>
</html>